package inabit.inabitcompiler.productions.rule.expressions;

import inabit.compiler.parser.grammar.NonTerminal;
import inabit.compiler.parser.grammar.Production;
import inabit.compiler.parser.grammar.Symbol;
import inabit.inabitcompiler.parser.InabitSemanticAction;

/**Rest -> O A*/
/**@author Rafael Rocha*/
public class Rest_Rule extends Production{

	private NonTerminal O, A;
	
	public Rest_Rule() {
		super("Rest");
	}

	@Override
	protected Symbol[] production(final NonTerminal nonTerminal) {
		O = new NonTerminal("O");
		A = new NonTerminal("A");
		Symbol[] symbols = {
				O, A,
				new InabitSemanticAction(nonTerminal) {
					
					@Override
					public void execute() throws Exception {
						nonTerminal.code = O.code + ":" + A.code; 
					}
				}
		};
		return symbols;
	}

}
